#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <ctype.h>

struct asdf {
	char fn[50];
	char ln[50];
};

int
main(int argc, char **argv)
{
	struct asdf people[100];
	int n = 0, i = 0;

	scanf("%d", &n);
	for (; i < n; ++i)
		scanf("%s%s", people[i].ln, people[i].fn);

	printf("%d\n", n);
	for (i = 0; i < n; ++i)
		printf("%s %s\n", people[i].fn, people[i].ln);

	return 0;
}
